package com.project.service.impl;

import java.util.List;
import java.util.Map;

import com.project.entity.Announcement;
import com.project.service.AnnouncementManager;
import com.project.mapper.*;

public class AnnouncementManagerService implements AnnouncementManager {

	AnnouncementMapper	announcementMapper;
	
	
	public AnnouncementMapper getAnnouncementMapper() {
		return announcementMapper;
	}

	public void setAnnouncementMapper(AnnouncementMapper announcementMapper) {
		this.announcementMapper = announcementMapper;
	}

	
	
	public void deleteById(Integer id) {
		// TODO Auto-generated method stub
		this.announcementMapper.deleteByPrimaryKey(id);
	}

	public List<Announcement> findByAuther(String autherName) {
		// TODO Auto-generated method stub
//		return this.announcementMapper.
		return null;
	}

	public Announcement findById(Integer id) {
		// TODO Auto-generated method stub
		return this.announcementMapper.selectByPrimaryKey(id);
	}

	public List<Announcement> getAllNotice(Map<String,String> map) {
		// TODO Auto-generated method stub
		return this.announcementMapper.getAll(map);
	}

	public void insertAnnouncement(Announcement announcement) {
		
		// TODO Auto-generated method stub
		try{
			this.announcementMapper.insert(announcement);
		}catch(Exception e){
			e.printStackTrace();
		}
		
	}

	public void updateAnnouncement(Announcement announcement) {
		// TODO Auto-generated method stub
		try{
			this.announcementMapper.updateByPrimaryKeySelective(announcement);
		}catch(Exception e){
			e.printStackTrace();
		}
	}

	public int totalCount(Map<String,String> map) {
		// TODO Auto-generated method stub
		return this.announcementMapper.countAnnounce(map);
	}

}
